const websocket = {
    state:
        {
            connected: false,
            websockect: {},
            user: {},
            login: false,
        },

    getters: {
        isConnected(state) {
            return state.connected;
        },
        getWebsocket(state) {
            return state.websockect;
        },
        getUser(state) {
            return state.user;
        },
        getLogin(state) {
            return state.login
        }

    },

    mutations: {
        updateConnected(state, connected) {
            state.connected = connected;
        },
        setWebSocket(state, websocket) {
            state.websockect = websocket
        },
        setUser(state, user) {
            state.user = user
        },
        setLogin(state, login) {
            state.login = login
        }
    },

    actions: {
        openConnect(context) {
            context.commit("updateConnected", true);
        },
        closeConnect(context) {
            context.commit("updateConnected", false);

        },
        setWebSocket(context, websocket) {
            context.commit("setWebSocket", websocket);
        },
        setUser(context, user) {
            context.commit("setUser", user)
        },
        setLogin(context, login) {
            context.commit("setLogin", login)
        }
    },
}
export default websocket;

//调用方法
//this.$store.dispatch("asyncUpdateTest",1212);
// this.$store.getters.getTest
//调用方法
//this.$store.dispatch("asyncUpdateTest",1212);
// this.$store.getters.getTest